package com.example.collectiondemo.map.demo;

import java.util.HashMap;
import java.util.Map;

public class HashMapDemo {
    public static void main(String[] args){
        //底层为哈希表 线程不安全
        HashMap hashMap = new HashMap<>();

        hashMap.put("name","jack");
        System.out.println(hashMap);//{name=jack}
        hashMap.put("name","zhes");
        System.out.println(hashMap);//{name=zhes}            键不可以重复
        hashMap.put("age","zhes");
        System.out.println(hashMap);//{name=zhes, age=zhes}  值可以重复
        hashMap.put("sex",null);
        hashMap.put(null,"sex");
        System.out.println(hashMap);//{null=sex, sex=null, name=zhes, age=zhes}  允许key value为null
        String ids = "23,33,45,12";
        String[] BoxNumber = ids.split(",");
        Map mapMM = new HashMap();
        for (int i = 0; i <BoxNumber.length ; i++) {
            mapMM.put("GUID",BoxNumber[i]);
        }
        System.out.println(mapMM);
        String BoxNumbesr = String.valueOf(ids.split(","));
        System.out.println(BoxNumber);

    }
}
